package com.example.demo.config;

import com.example.demo.entity.Computer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

@Configuration
public class ComputerAutoConfigurationConfig {
    @ConditionalOnMissingBean(Computer.class)
    @Bean("reservePC")
    public Computer computer2(){
        return new Computer("备用电脑");
    }

    @Bean(name = "notebookPC")
//    @ConditionalOnMissingBean(Computer.class)
    public Computer computer1(){
        return new Computer("笔记本电脑");
    }

}
